/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmMain.java
 *
 * Created on Apr 10, 2010, 11:39:18 PM
 */
package GUI;

import Validate_Connect.DataInteraction;
import Interact.Login;
import LookAndFeelWindow.LookAndFeelWindow;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Shinichi
 */
public class frmMain extends javax.swing.JFrame {

    /** Creates new form frmMain */
    public frmMain() throws ClassNotFoundException, SQLException, UnsupportedLookAndFeelException {
        LookAndFeelWindow.LookAndFeelWindow();
//        ClockThread _clock = new ClockThread();
//        _clock.start();
        initComponents();
        try {
            setIconImage(Toolkit.getDefaultToolkit().getImage(new File("src//Image//Home.png").getCanonicalPath()));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        ;
        String _day = DataInteraction.getDateNow("EEEEE");
        String _datenow = DataInteraction.getDateNow("dd,");
        String _MonthYear = DataInteraction.getDateNow("MMMMM, " + "  " + " yyyy");
        _lblday.setText(_day);
        _lbldatenow.setText(_datenow);
        _lblMonthYear.setText(_MonthYear);

        permissing();
        _lblAccount.setText(Login.get_Username());
        if (Login.get_Role().equals("ADM")) {
            _lblAccountType.setText("(Administrator)");
        } else if (Login.get_Role().equals("STA")) {
            _lblAccountType.setText(Login.get_Role() + "(Staff)");
        }
    }

//    class ClockThread extends Thread {
//
//        @Override
//        public void run() {
//            while (true) {
//                try {
//                    ClockThread.sleep(1000);
//                    Calendar cal = Calendar.getInstance();
//                    SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss ");
//                    _lblclock.setText(sdf.format(cal.getTime()));
//                } catch (InterruptedException ex) {
//                    Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
//                }
//            }
//        }
//    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        _dtpmain = new javax.swing.JDesktopPane();
        jLabel3 = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        _tbr_btnAccount = new javax.swing.JButton();
        _tbr_btnChangePass = new javax.swing.JButton();
        _tbr_btnLogout = new javax.swing.JButton();
        jToolBar2 = new javax.swing.JToolBar();
        jSeparator9 = new javax.swing.JToolBar.Separator();
        _tbr_btnUser = new javax.swing.JButton();
        _tbr_btnStudent = new javax.swing.JButton();
        _tbr_btnSubject = new javax.swing.JButton();
        _tbr_btnCourses = new javax.swing.JButton();
        _tbr_btn_Schedule = new javax.swing.JButton();
        _tbr_btnRole = new javax.swing.JButton();
        jToolBar3 = new javax.swing.JToolBar();
        jSeparator10 = new javax.swing.JToolBar.Separator();
        _tbr_btnCalculator = new javax.swing.JButton();
        jToolBar4 = new javax.swing.JToolBar();
        _lblwellcome = new javax.swing.JLabel();
        _lblAccount = new javax.swing.JLabel();
        _lblAccountType = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        _mnusystem = new javax.swing.JMenu();
        _mitlogon = new javax.swing.JMenuItem();
        _mitAccount = new javax.swing.JMenuItem();
        _mitchangepass = new javax.swing.JMenuItem();
        _mitlogout = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        _mitexit = new javax.swing.JMenuItem();
        _mnuadmin = new javax.swing.JMenu();
        _mitStudent = new javax.swing.JMenuItem();
        _mitUser = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        _mitRole = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        _mitClass = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        _mitCourses = new javax.swing.JMenuItem();
        _mitTrain = new javax.swing.JMenuItem();
        _mitSubject = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JPopupMenu.Separator();
        _mitSchedule = new javax.swing.JMenuItem();
        _mitSubjectSchedule = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        _mitCalculator = new javax.swing.JMenuItem();
        _mnuhelp = new javax.swing.JMenu();
        _mithelp = new javax.swing.JMenuItem();
        _mitabout = new javax.swing.JMenuItem();
        _lblday = new javax.swing.JLabel();
        _lbldatenow = new javax.swing.JLabel();
        _lblMonthYear = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jMenuBar2 = new javax.swing.JMenuBar();
        _mnusystem1 = new javax.swing.JMenu();
        _mitlogon1 = new javax.swing.JMenuItem();
        _mitAccount1 = new javax.swing.JMenuItem();
        _mitchangepass1 = new javax.swing.JMenuItem();
        _mitlogout1 = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JPopupMenu.Separator();
        _mitexit1 = new javax.swing.JMenuItem();
        _mnuadmin1 = new javax.swing.JMenu();
        _mitStudent1 = new javax.swing.JMenuItem();
        _mitUser1 = new javax.swing.JMenuItem();
        jSeparator7 = new javax.swing.JPopupMenu.Separator();
        _mitRole1 = new javax.swing.JMenuItem();
        jSeparator8 = new javax.swing.JPopupMenu.Separator();
        _mitClass1 = new javax.swing.JMenuItem();
        jSeparator11 = new javax.swing.JPopupMenu.Separator();
        _mitCourses1 = new javax.swing.JMenuItem();
        _mitTrain1 = new javax.swing.JMenuItem();
        _mitSubject1 = new javax.swing.JMenuItem();
        jSeparator12 = new javax.swing.JPopupMenu.Separator();
        _mitSchedule1 = new javax.swing.JMenuItem();
        _mitSubjectSchedule1 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        _mitCalculator1 = new javax.swing.JMenuItem();
        _mnuhelp1 = new javax.swing.JMenu();
        _mithelp1 = new javax.swing.JMenuItem();
        _mitabout1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("AITSM - Andrews Institute of technical sciences and Management");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        _dtpmain.setBackground(new java.awt.Color(255, 255, 255));
        _dtpmain.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/main.png"))); // NOI18N
        jLabel3.setBounds(80, 10, 1040, 540);
        _dtpmain.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);

        _tbr_btnAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/InfomationThumb3.png"))); // NOI18N
        _tbr_btnAccount.setFocusable(false);
        _tbr_btnAccount.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnAccount.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnAccountActionPerformed(evt);
            }
        });
        jToolBar1.add(_tbr_btnAccount);

        _tbr_btnChangePass.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/password40x40.png"))); // NOI18N
        _tbr_btnChangePass.setFocusable(false);
        _tbr_btnChangePass.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnChangePass.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnChangePass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnChangePassActionPerformed(evt);
            }
        });
        jToolBar1.add(_tbr_btnChangePass);

        _tbr_btnLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Logout.png"))); // NOI18N
        _tbr_btnLogout.setFocusable(false);
        _tbr_btnLogout.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnLogout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnLogoutActionPerformed(evt);
            }
        });
        jToolBar1.add(_tbr_btnLogout);

        jToolBar2.setFloatable(false);
        jToolBar2.setRollover(true);
        jToolBar2.add(jSeparator9);

        _tbr_btnUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/kuser40x40.png"))); // NOI18N
        _tbr_btnUser.setToolTipText("User");
        _tbr_btnUser.setFocusable(false);
        _tbr_btnUser.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnUser.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnUserActionPerformed(evt);
            }
        });
        jToolBar2.add(_tbr_btnUser);

        _tbr_btnStudent.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/student40x40.png"))); // NOI18N
        _tbr_btnStudent.setToolTipText("Student");
        _tbr_btnStudent.setFocusable(false);
        _tbr_btnStudent.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnStudent.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnStudent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnStudentActionPerformed(evt);
            }
        });
        jToolBar2.add(_tbr_btnStudent);

        _tbr_btnSubject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Users.png"))); // NOI18N
        _tbr_btnSubject.setFocusable(false);
        _tbr_btnSubject.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnSubject.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnSubject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnSubjectActionPerformed(evt);
            }
        });
        jToolBar2.add(_tbr_btnSubject);

        _tbr_btnCourses.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/CP.png"))); // NOI18N
        _tbr_btnCourses.setToolTipText("Courses");
        _tbr_btnCourses.setFocusable(false);
        _tbr_btnCourses.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnCourses.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnCourses.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnCoursesActionPerformed(evt);
            }
        });
        jToolBar2.add(_tbr_btnCourses);

        _tbr_btn_Schedule.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Campaign.png"))); // NOI18N
        _tbr_btn_Schedule.setToolTipText("Schedule");
        _tbr_btn_Schedule.setFocusable(false);
        _tbr_btn_Schedule.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btn_Schedule.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btn_Schedule.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btn_ScheduleActionPerformed(evt);
            }
        });
        jToolBar2.add(_tbr_btn_Schedule);

        _tbr_btnRole.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Product.png"))); // NOI18N
        _tbr_btnRole.setToolTipText("Roles");
        _tbr_btnRole.setFocusable(false);
        _tbr_btnRole.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnRole.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnRole.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnRoleActionPerformed(evt);
            }
        });
        jToolBar2.add(_tbr_btnRole);

        jToolBar3.setFloatable(false);
        jToolBar3.setRollover(true);
        jToolBar3.add(jSeparator10);

        _tbr_btnCalculator.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/calculator1.png"))); // NOI18N
        _tbr_btnCalculator.setToolTipText("Calculator");
        _tbr_btnCalculator.setFocusable(false);
        _tbr_btnCalculator.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        _tbr_btnCalculator.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        _tbr_btnCalculator.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _tbr_btnCalculatorActionPerformed(evt);
            }
        });
        jToolBar3.add(_tbr_btnCalculator);

        jToolBar4.setFloatable(false);
        jToolBar4.setRollover(true);

        _lblwellcome.setFont(new java.awt.Font("Tahoma", 0, 14));
        _lblwellcome.setForeground(new java.awt.Color(0, 0, 255));
        _lblwellcome.setText("Wellcome:");

        _lblAccount.setFont(new java.awt.Font("Tahoma", 1, 14));
        _lblAccount.setForeground(new java.awt.Color(255, 0, 0));
        _lblAccount.setText("_lblAccount");

        _lblAccountType.setFont(new java.awt.Font("Tahoma", 0, 12));
        _lblAccountType.setForeground(new java.awt.Color(51, 51, 255));
        _lblAccountType.setText("_lblAccountType");

        _mnusystem.setText("System");

        _mitlogon.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        _mitlogon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/system2.png"))); // NOI18N
        _mitlogon.setText("Logon");
        _mitlogon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitlogonActionPerformed(evt);
            }
        });
        _mnusystem.add(_mitlogon);

        _mitAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/InfomationThumb2.png"))); // NOI18N
        _mitAccount.setText("Account");
        _mitAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitAccountActionPerformed(evt);
            }
        });
        _mnusystem.add(_mitAccount);

        _mitchangepass.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        _mitchangepass.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Settings1.png"))); // NOI18N
        _mitchangepass.setText("Change your password");
        _mitchangepass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitchangepassActionPerformed(evt);
            }
        });
        _mnusystem.add(_mitchangepass);

        _mitlogout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        _mitlogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Logout20x20.png"))); // NOI18N
        _mitlogout.setText("Logout");
        _mitlogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitlogoutActionPerformed(evt);
            }
        });
        _mnusystem.add(_mitlogout);
        _mnusystem.add(jSeparator1);

        _mitexit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        _mitexit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/exit2.png"))); // NOI18N
        _mitexit.setText("Exit");
        _mitexit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitexitActionPerformed(evt);
            }
        });
        _mnusystem.add(_mitexit);

        jMenuBar1.add(_mnusystem);

        _mnuadmin.setText("Admin");
        _mnuadmin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mnuadminActionPerformed(evt);
            }
        });

        _mitStudent.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.ALT_MASK));
        _mitStudent.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/student2.png"))); // NOI18N
        _mitStudent.setText("Student");
        _mitStudent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitStudentActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitStudent);

        _mitUser.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_2, java.awt.event.InputEvent.ALT_MASK));
        _mitUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/kuser2.png"))); // NOI18N
        _mitUser.setText("User");
        _mitUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitUserActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitUser);
        _mnuadmin.add(jSeparator2);

        _mitRole.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_3, java.awt.event.InputEvent.ALT_MASK));
        _mitRole.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Product1.png"))); // NOI18N
        _mitRole.setText("Role");
        _mitRole.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitRoleActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitRole);
        _mnuadmin.add(jSeparator3);

        _mitClass.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_4, java.awt.event.InputEvent.ALT_MASK));
        _mitClass.setText("Class");
        _mitClass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitClassActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitClass);
        _mnuadmin.add(jSeparator4);

        _mitCourses.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_5, java.awt.event.InputEvent.ALT_MASK));
        _mitCourses.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/CPThumb1.png"))); // NOI18N
        _mitCourses.setText("Courses");
        _mitCourses.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitCoursesActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitCourses);

        _mitTrain.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_6, java.awt.event.InputEvent.ALT_MASK));
        _mitTrain.setText("Trainings");
        _mitTrain.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitTrainActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitTrain);

        _mitSubject.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_7, java.awt.event.InputEvent.ALT_MASK));
        _mitSubject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Users1.png"))); // NOI18N
        _mitSubject.setText("Subject");
        _mitSubject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitSubjectActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitSubject);
        _mnuadmin.add(jSeparator5);

        _mitSchedule.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_8, java.awt.event.InputEvent.ALT_MASK));
        _mitSchedule.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Campaign1.png"))); // NOI18N
        _mitSchedule.setText("Schedule");
        _mitSchedule.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitScheduleActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitSchedule);

        _mitSubjectSchedule.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_9, java.awt.event.InputEvent.ALT_MASK));
        _mitSubjectSchedule.setText("Subject Schedule");
        _mitSubjectSchedule.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitSubjectScheduleActionPerformed(evt);
            }
        });
        _mnuadmin.add(_mitSubjectSchedule);

        jMenuBar1.add(_mnuadmin);

        jMenu2.setText("Tools");

        _mitCalculator.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/calculator2.png"))); // NOI18N
        _mitCalculator.setText("Calculator");
        _mitCalculator.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitCalculatorActionPerformed(evt);
            }
        });
        jMenu2.add(_mitCalculator);

        jMenuBar1.add(jMenu2);

        _mnuhelp.setText("Help");

        _mithelp.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        _mithelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/help.png"))); // NOI18N
        _mithelp.setText("Help Content");
        _mithelp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mithelpActionPerformed(evt);
            }
        });
        _mnuhelp.add(_mithelp);

        _mitabout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/about.png"))); // NOI18N
        _mitabout.setText("About");
        _mitabout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitaboutActionPerformed(evt);
            }
        });
        _mnuhelp.add(_mitabout);

        jMenuBar1.add(_mnuhelp);

        _lblday.setForeground(new java.awt.Color(0, 102, 102));
        _lblday.setText("_lblday");

        _lbldatenow.setForeground(new java.awt.Color(0, 102, 102));
        _lbldatenow.setText("_lbldatenow");

        _lblMonthYear.setForeground(new java.awt.Color(0, 102, 102));
        _lblMonthYear.setText("_lblMonthYear");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel1.setText("AITSM - Andrews Institute of technical sciences and Management");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel4.setText("Group 2:");

        jLabel2.setText("Copyright © 2010 - Group 2 - C0909G");

        jLabel5.setText("Dang Thai Ngoc  (dangthaingoc1990@gmail.com)");

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel8.setText("Contact us:");

        jLabel6.setText("Le Anh Thai  (leanhthai90@gmail.com)");

        jLabel7.setText("Bui Tien Thoai   (thoai1988@gmail.com)");

        jLabel11.setText("Mobile: +84978982586");

        jLabel10.setText("Email: dangthaingoc1990@gmail.com");

        jLabel9.setText("Y!M: dangthaingoc1990");

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                .add(27, 27, 27)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel1)
                    .add(jLabel2))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 98, Short.MAX_VALUE)
                .add(jLabel4)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel5)
                    .add(jLabel6)
                    .add(jLabel7))
                .add(111, 111, 111)
                .add(jLabel8)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel11)
                    .add(jLabel10)
                    .add(jLabel9))
                .add(46, 46, 46))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel4)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel5)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel6)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel7))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel8)
                            .add(jLabel9))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel10)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel11))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel2)))
                .addContainerGap())
        );

        _mnusystem1.setMnemonic('S');
        _mnusystem1.setText("System");

        _mitlogon1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        _mitlogon1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/system2.png"))); // NOI18N
        _mitlogon1.setText("Logon");
        _mitlogon1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitlogonActionPerformed(evt);
            }
        });
        _mnusystem1.add(_mitlogon1);

        _mitAccount1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/InfomationThumb2.png"))); // NOI18N
        _mitAccount1.setText("Account");
        _mitAccount1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitAccountActionPerformed(evt);
            }
        });
        _mnusystem1.add(_mitAccount1);

        _mitchangepass1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        _mitchangepass1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Settings1.png"))); // NOI18N
        _mitchangepass1.setText("Change your password");
        _mitchangepass1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitchangepassActionPerformed(evt);
            }
        });
        _mnusystem1.add(_mitchangepass1);

        _mitlogout1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        _mitlogout1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Logout20x20.png"))); // NOI18N
        _mitlogout1.setText("Logout");
        _mitlogout1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitlogoutActionPerformed(evt);
            }
        });
        _mnusystem1.add(_mitlogout1);
        _mnusystem1.add(jSeparator6);

        _mitexit1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        _mitexit1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/exit2.png"))); // NOI18N
        _mitexit1.setText("Exit");
        _mitexit1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitexitActionPerformed(evt);
            }
        });
        _mnusystem1.add(_mitexit1);

        jMenuBar2.add(_mnusystem1);

        _mnuadmin1.setMnemonic('A');
        _mnuadmin1.setText("Admin");
        _mnuadmin1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mnuadminActionPerformed(evt);
            }
        });

        _mitStudent1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_1, java.awt.event.InputEvent.ALT_MASK));
        _mitStudent1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/student2.png"))); // NOI18N
        _mitStudent1.setText("Student");
        _mitStudent1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitStudentActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitStudent1);

        _mitUser1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_2, java.awt.event.InputEvent.ALT_MASK));
        _mitUser1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/kuser2.png"))); // NOI18N
        _mitUser1.setText("User");
        _mitUser1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitUserActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitUser1);
        _mnuadmin1.add(jSeparator7);

        _mitRole1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_3, java.awt.event.InputEvent.ALT_MASK));
        _mitRole1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Product1.png"))); // NOI18N
        _mitRole1.setText("Role");
        _mitRole1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitRoleActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitRole1);
        _mnuadmin1.add(jSeparator8);

        _mitClass1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_4, java.awt.event.InputEvent.ALT_MASK));
        _mitClass1.setText("Class");
        _mitClass1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitClassActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitClass1);
        _mnuadmin1.add(jSeparator11);

        _mitCourses1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_5, java.awt.event.InputEvent.ALT_MASK));
        _mitCourses1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/CPThumb1.png"))); // NOI18N
        _mitCourses1.setText("Courses");
        _mitCourses1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitCoursesActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitCourses1);

        _mitTrain1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_6, java.awt.event.InputEvent.ALT_MASK));
        _mitTrain1.setText("Trainings");
        _mitTrain1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitTrainActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitTrain1);

        _mitSubject1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_7, java.awt.event.InputEvent.ALT_MASK));
        _mitSubject1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Users1.png"))); // NOI18N
        _mitSubject1.setText("Subject");
        _mitSubject1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitSubjectActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitSubject1);
        _mnuadmin1.add(jSeparator12);

        _mitSchedule1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_8, java.awt.event.InputEvent.ALT_MASK));
        _mitSchedule1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Campaign1.png"))); // NOI18N
        _mitSchedule1.setText("Schedule");
        _mitSchedule1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitScheduleActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitSchedule1);

        _mitSubjectSchedule1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_9, java.awt.event.InputEvent.ALT_MASK));
        _mitSubjectSchedule1.setText("Subject Schedule");
        _mitSubjectSchedule1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitSubjectScheduleActionPerformed(evt);
            }
        });
        _mnuadmin1.add(_mitSubjectSchedule1);

        jMenuBar2.add(_mnuadmin1);

        jMenu3.setMnemonic('T');
        jMenu3.setText("Tools");

        _mitCalculator1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/calculator2.png"))); // NOI18N
        _mitCalculator1.setText("Calculator");
        _mitCalculator1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitCalculatorActionPerformed(evt);
            }
        });
        jMenu3.add(_mitCalculator1);

        jMenuBar2.add(jMenu3);

        _mnuhelp1.setMnemonic('H');
        _mnuhelp1.setText("Help");

        _mithelp1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        _mithelp1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/help.png"))); // NOI18N
        _mithelp1.setText("Help Content");
        _mithelp1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mithelpActionPerformed(evt);
            }
        });
        _mnuhelp1.add(_mithelp1);

        _mitabout1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/about.png"))); // NOI18N
        _mitabout1.setText("About");
        _mitabout1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                _mitaboutActionPerformed(evt);
            }
        });
        _mnuhelp1.add(_mitabout1);

        jMenuBar2.add(_mnuhelp1);

        setJMenuBar(jMenuBar2);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(jToolBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jToolBar2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jToolBar3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(430, 430, 430)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(layout.createSequentialGroup()
                        .add(_lblwellcome)
                        .add(6, 6, 6)
                        .add(_lblAccount, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 91, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(_lblAccountType))
                    .add(layout.createSequentialGroup()
                        .add(_lblday, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 57, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(_lbldatenow)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(_lblMonthYear)))
                .add(18, 18, 18)
                .add(jToolBar4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(layout.createSequentialGroup()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .add(_dtpmain, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1209, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(_lblwellcome)
                            .add(_lblAccountType)
                            .add(_lblAccount))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 8, Short.MAX_VALUE)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(_lbldatenow)
                            .add(_lblday)
                            .add(_lblMonthYear)))
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jToolBar2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jToolBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jToolBar4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jToolBar3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(_dtpmain, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 561, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void _mitaboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitaboutActionPerformed
        frmAbout _frmAbout = new frmAbout(null, true);
        _frmAbout.setLocationRelativeTo(null);
        _frmAbout.setVisible(true);
    }//GEN-LAST:event__mitaboutActionPerformed

    private void _mithelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mithelpActionPerformed
//        try {            
//            Runtime.getRuntime().exec("rundll32.exe url.dll,FileProtocolHandler readme.doc");
//        } catch (IOException ex) {
//            Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
//        }
    }//GEN-LAST:event__mithelpActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        int i = JOptionPane.showConfirmDialog(null, "Do you want to exit?", "Exit", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (i == 0) {
            System.exit(i);
        }
    }//GEN-LAST:event_formWindowClosing

    private void _mitlogonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitlogonActionPerformed
        try {
            this.dispose();
            frmLogin _frmlogin = new frmLogin();
            _frmlogin.setLocationRelativeTo(null);
            _frmlogin.setVisible(true);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event__mitlogonActionPerformed

    private void _mitexitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitexitActionPerformed
        int i = JOptionPane.showConfirmDialog(null, "Do you want to exit", "Exit", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (i == 0) {
            System.exit(i);
        }
    }//GEN-LAST:event__mitexitActionPerformed

    private void _mitchangepassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitchangepassActionPerformed
        frmChangePassword _frmchangepass = new frmChangePassword(null, true);
        _frmchangepass.setLocationRelativeTo(null);
        _frmchangepass.setTitle("Change Password   -   " + Login.get_Username());
        _frmchangepass.setVisible(true);
    }//GEN-LAST:event__mitchangepassActionPerformed

    private void _mitlogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitlogoutActionPerformed
        int i = JOptionPane.showConfirmDialog(null, "Do you want to log out?", "Log out", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (i == 0) {
            try {
                this.dispose();
                frmLogin _frmlogin = new frmLogin();
                _frmlogin.setLocationRelativeTo(null);
                _frmlogin.setVisible(true);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
            }
        }


    }//GEN-LAST:event__mitlogoutActionPerformed

    private void _mitStudentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitStudentActionPerformed

        frmStudent _frmStudent = new frmStudent();
        _dtpmain.add(_frmStudent);
        _frmStudent.setVisible(true);
}//GEN-LAST:event__mitStudentActionPerformed

    private void _mitCalculatorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitCalculatorActionPerformed
        try {
            Runtime.getRuntime().exec("rundll32.exe url.dll,FileProtocolHandler calc.exe");
        } catch (IOException ex) {
            Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event__mitCalculatorActionPerformed

    private void _tbr_btnChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnChangePassActionPerformed
        _mitchangepassActionPerformed(evt);
    }//GEN-LAST:event__tbr_btnChangePassActionPerformed

    private void _tbr_btnAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnAccountActionPerformed
        frmAccountDetail _frmAccountDetail = new frmAccountDetail(null, true);
        _frmAccountDetail.setLocationRelativeTo(null);
        _frmAccountDetail.setVisible(true);
}//GEN-LAST:event__tbr_btnAccountActionPerformed

    private void _mitSubjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitSubjectActionPerformed
        frmSubjectList _frmSubjectList = new frmSubjectList();
        _dtpmain.add(_frmSubjectList);
        _frmSubjectList.setVisible(true);
}//GEN-LAST:event__mitSubjectActionPerformed

    private void _mitAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitAccountActionPerformed
        _tbr_btnAccountActionPerformed(evt);
    }//GEN-LAST:event__mitAccountActionPerformed

    private void _mitRoleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitRoleActionPerformed
        frmRole _frmRole = new frmRole();
        _dtpmain.add(_frmRole);
        _frmRole.setVisible(true);
}//GEN-LAST:event__mitRoleActionPerformed

    private void _mitClassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitClassActionPerformed
        frmClass _frmClass = new frmClass();
        if (_frmClass.isVisible() == true) {
            JOptionPane.showMessageDialog(null, "Class List is display", "Warning", JOptionPane.WARNING_MESSAGE);
        } else {
            _dtpmain.add(_frmClass);
            _frmClass.setVisible(true);
        }

}//GEN-LAST:event__mitClassActionPerformed

    private void _mitCoursesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitCoursesActionPerformed
        frmCourses _frmCourses = new frmCourses();
        _dtpmain.add(_frmCourses);
        _frmCourses.setVisible(true);
}//GEN-LAST:event__mitCoursesActionPerformed

    private void _mitTrainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitTrainActionPerformed
        frmTraining _frmTrain = new frmTraining();
        _dtpmain.add(_frmTrain);
        _frmTrain.setVisible(true);
}//GEN-LAST:event__mitTrainActionPerformed

private void _mnuadminActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mnuadminActionPerformed
    frmSubjectSchedule _frmsubjectSchedule = new frmSubjectSchedule();
    _dtpmain.add(_frmsubjectSchedule);
    _frmsubjectSchedule.setVisible(true);
}//GEN-LAST:event__mnuadminActionPerformed

private void _mitUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitUserActionPerformed
    frmUser _frmUser = new frmUser();
    _dtpmain.add(_frmUser);
    _frmUser.setVisible(true);
}//GEN-LAST:event__mitUserActionPerformed

private void _mitScheduleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitScheduleActionPerformed
    frmSchedule _frmSchedule = new frmSchedule();
    _dtpmain.add(_frmSchedule);
    _frmSchedule.setVisible(true);
}//GEN-LAST:event__mitScheduleActionPerformed

private void _tbr_btnUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnUserActionPerformed
    _mitUserActionPerformed(evt);
}//GEN-LAST:event__tbr_btnUserActionPerformed

private void _tbr_btnStudentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnStudentActionPerformed
    _mitStudentActionPerformed(evt);
}//GEN-LAST:event__tbr_btnStudentActionPerformed

private void _mitSubjectScheduleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__mitSubjectScheduleActionPerformed
    frmSubjectSchedule _frmSubSche = new frmSubjectSchedule();
    _dtpmain.add(_frmSubSche);
    _frmSubSche.setVisible(true);
}//GEN-LAST:event__mitSubjectScheduleActionPerformed

private void _tbr_btnSubjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnSubjectActionPerformed
    _mitSubjectActionPerformed(evt);
}//GEN-LAST:event__tbr_btnSubjectActionPerformed

private void _tbr_btnCoursesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnCoursesActionPerformed
    _mitCoursesActionPerformed(evt);
}//GEN-LAST:event__tbr_btnCoursesActionPerformed

private void _tbr_btn_ScheduleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btn_ScheduleActionPerformed
    _mitScheduleActionPerformed(evt);
}//GEN-LAST:event__tbr_btn_ScheduleActionPerformed

private void _tbr_btnCalculatorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnCalculatorActionPerformed
    _mitCalculatorActionPerformed(evt);
}//GEN-LAST:event__tbr_btnCalculatorActionPerformed

private void _tbr_btnRoleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnRoleActionPerformed
    _mitRoleActionPerformed(evt);
}//GEN-LAST:event__tbr_btnRoleActionPerformed

private void _tbr_btnLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__tbr_btnLogoutActionPerformed
    _mitlogoutActionPerformed(evt);
}//GEN-LAST:event__tbr_btnLogoutActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                try {
//                    new frmMain().setVisible(true);
//                } catch (ClassNotFoundException ex) {
//                    Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
//                } catch (SQLException ex) {
//                    Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
//                } catch (UnsupportedLookAndFeelException ex) {
//                    Logger.getLogger(frmMain.class.getName()).log(Level.SEVERE, null, ex);
//                }
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane _dtpmain;
    private javax.swing.JLabel _lblAccount;
    private javax.swing.JLabel _lblAccountType;
    private javax.swing.JLabel _lblMonthYear;
    private javax.swing.JLabel _lbldatenow;
    private javax.swing.JLabel _lblday;
    private javax.swing.JLabel _lblwellcome;
    private javax.swing.JMenuItem _mitAccount;
    private javax.swing.JMenuItem _mitAccount1;
    private javax.swing.JMenuItem _mitCalculator;
    private javax.swing.JMenuItem _mitCalculator1;
    private javax.swing.JMenuItem _mitClass;
    private javax.swing.JMenuItem _mitClass1;
    private javax.swing.JMenuItem _mitCourses;
    private javax.swing.JMenuItem _mitCourses1;
    private javax.swing.JMenuItem _mitRole;
    private javax.swing.JMenuItem _mitRole1;
    private javax.swing.JMenuItem _mitSchedule;
    private javax.swing.JMenuItem _mitSchedule1;
    private javax.swing.JMenuItem _mitStudent;
    private javax.swing.JMenuItem _mitStudent1;
    private javax.swing.JMenuItem _mitSubject;
    private javax.swing.JMenuItem _mitSubject1;
    private javax.swing.JMenuItem _mitSubjectSchedule;
    private javax.swing.JMenuItem _mitSubjectSchedule1;
    private javax.swing.JMenuItem _mitTrain;
    private javax.swing.JMenuItem _mitTrain1;
    private javax.swing.JMenuItem _mitUser;
    private javax.swing.JMenuItem _mitUser1;
    private javax.swing.JMenuItem _mitabout;
    private javax.swing.JMenuItem _mitabout1;
    private javax.swing.JMenuItem _mitchangepass;
    private javax.swing.JMenuItem _mitchangepass1;
    private javax.swing.JMenuItem _mitexit;
    private javax.swing.JMenuItem _mitexit1;
    private javax.swing.JMenuItem _mithelp;
    private javax.swing.JMenuItem _mithelp1;
    private javax.swing.JMenuItem _mitlogon;
    private javax.swing.JMenuItem _mitlogon1;
    private javax.swing.JMenuItem _mitlogout;
    private javax.swing.JMenuItem _mitlogout1;
    private javax.swing.JMenu _mnuadmin;
    private javax.swing.JMenu _mnuadmin1;
    private javax.swing.JMenu _mnuhelp;
    private javax.swing.JMenu _mnuhelp1;
    private javax.swing.JMenu _mnusystem;
    private javax.swing.JMenu _mnusystem1;
    private javax.swing.JButton _tbr_btnAccount;
    private javax.swing.JButton _tbr_btnCalculator;
    private javax.swing.JButton _tbr_btnChangePass;
    private javax.swing.JButton _tbr_btnCourses;
    private javax.swing.JButton _tbr_btnLogout;
    private javax.swing.JButton _tbr_btnRole;
    private javax.swing.JButton _tbr_btnStudent;
    private javax.swing.JButton _tbr_btnSubject;
    private javax.swing.JButton _tbr_btnUser;
    private javax.swing.JButton _tbr_btn_Schedule;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator10;
    private javax.swing.JPopupMenu.Separator jSeparator11;
    private javax.swing.JPopupMenu.Separator jSeparator12;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JPopupMenu.Separator jSeparator5;
    private javax.swing.JPopupMenu.Separator jSeparator6;
    private javax.swing.JPopupMenu.Separator jSeparator7;
    private javax.swing.JPopupMenu.Separator jSeparator8;
    private javax.swing.JToolBar.Separator jSeparator9;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JToolBar jToolBar3;
    private javax.swing.JToolBar jToolBar4;
    // End of variables declaration//GEN-END:variables

    public void permissing() throws ClassNotFoundException, SQLException, UnsupportedLookAndFeelException {
        if (Login.get_UserID() == null && Login.get_Username() == null && Login.get_Password() == null && Login.get_Role() == null) {

            frmLogin _frmlogin = new frmLogin();
            this.dispose();
            _frmlogin.setLocationRelativeTo(null);
            _frmlogin.setVisible(true);
        } else if (Login.get_Role().equals("ADM")) {
            _mnusystem.setVisible(true);
            _mnuadmin.setVisible(true);
            _mnuhelp.setVisible(true);
            _mitlogon1.setEnabled(false);
        } else if (Login.get_Role().equals("STA")) {
            _mnusystem.setVisible(true);
            _mnuadmin.setVisible(false);
            _mnuhelp.setVisible(true);
            _mitlogon1.setEnabled(false);
        }
    }
}
